package com.cdyx.outsideprescription.controller;


import com.cdyx.outsideprescription.entity.TbPsnInfo;
import com.cdyx.outsideprescription.service.ITbPsnInfoService;
import com.cdyx.outsideprescription.util.AppResponse;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author jiang dongqiong
 * @since 2021-12-18
 */
@RestController
@RequestMapping("/outsideprescription/psnInfo")
public class PsnInfoController {
    @Qualifier("psnInfoServiceImpl")
    @Autowired
    public ITbPsnInfoService psnInfoService;
    @ApiOperation("获取病人信息")
    @GetMapping("getPsnInfo/{visitNo}/{org_med_type}")
    public AppResponse getPsnInfo(@PathVariable String visitNo,@PathVariable String org_med_type){
        long l = System.currentTimeMillis();
        Map<String,Object> indexInfo= psnInfoService.dealPsnInfo(visitNo,org_med_type);
        long l1 = System.currentTimeMillis();
        long l2 =  l1- l;
        System.out.println("总共花了-------------》"+l2);
        if (indexInfo.get("psnInfo")==null){
            return AppResponse.fail("没有此病人");
        }else {
            return AppResponse.ok(indexInfo);
        }
    }
}
